"Produit une info-bulle lorsque l'utilisateur survole l'image-objet." & RETURN & RETURN & \
"Remarque : ce comportement appelle le comportement 'Affichage de texte' pour afficher le message. " & \
"Le comportement 'Affichage de texte' doit Ωtre liΘ α une image-objet distincte contenant un acteur champ ou un acteur texte." & RETURN & RETURN & \
"Si une telle image-objet existe, elle sera automatiquement sΘlectionnΘe dans la boεte de dialogue ParamΦtres des comportements." & RETURN & RETURN & \
"Pour que l'info-bulle apparaisse dans une position donnΘe par rapport α l'image-objet actuelle, sΘlectionnez la position adΘquate dans la boεte de dialogue ParamΦtres des comportements et vΘrifiez que le comportement 'Affichage de texte' associΘ est dΘfini pour rΘagir en tant qu'info-bulle. " & \
"Si le comportement 'Affichage de texte' est dΘfini pour agir en tant que barre d'Θtat, il ignore toutes les donnΘes de positionnement et apparaεt dans une position fixe." & RETURN & RETURN & \
"Vous pouvez choisir de faire apparaεtre l'info-bulle au survol ou uniquement si la souris s'attarde sur l'image-objet pendant une pΘriode donnΘe. " & \
"Vous pouvez Θgalement choisir de faire disparaεtre l'info-bulle lorsque l'utilisateur clique sur l'image-objet." & RETURN & RETURN & \
"La boεte de dialogue ParamΦtres du comportement dispose d'un espace limitΘ pour la saisie du contenu de l'info-bulle. " & \
"Elle n'accepte pas les chaεnes contenant un caractΦre de retour α la ligne. " & \
"Pour afficher une longue info-bulle consistant de plusieurs lignes de texte devant apparaεtre α la position de cette image-objet, vous devrez envoyer un message contenant la chaεne requise α ce comportement. " & \
"Cela produit le message suivant lorsque la souris survole l'image-objet 1 :" & RETURN & RETURN & \
"Ce message consiste en" & RETURN & \
"deux lignes de texte" & RETURN & RETURN & \
"Si l'info-bulle produite par ce comportement doit Ωtre affichΘe dans une barre d'Θtat, cette Θtape n'est pas nΘcessaire. " & \
"Le comportement 'Affichage de texte' assure qu'une longue ligne de texte est mise α la ligne dans la barre d'Θtat et qu'une barre de dΘfilement apparaεt si nΘcessaire." & RETURN & RETURN & \
"Types d'acteurs autorisΘs :" & RETURN & \
"tous" & RETURN & RETURN & \
"ParamΦtres :" & RETURN & \
"* Texte de l'info-bulle (chaεne d'une ligne)" & RETURN & \
"* DΘlai avant l'affichage de l'info-bulle (en battements)" & RETURN & \
"* Masquer l'info-bulle lors d'un clic sur l'image-objet ? (TRUE | FALSE)" & RETURN & \
"* Position de l'info-bulle par rapport α l'image-objet (non prise en compte si le comportement 'Affichage de texte' est dΘfini pour rΘagir en tant que barre d'Θtat)." & RETURN & \
"* NumΘro de l'image-objet dans laquelle l'info-bulle doit Ωtre affichΘe. " & \
"(Le comportement 'Affichage de texte' doit Ωtre liΘ α cette image-objet. " & \
"Si l'image-objet est dΘplacΘe, une alerte vous invitera α mettre les paramΦtres de comportement α jour)." & RETURN & RETURN & \
"MΘthodes publiques :" & RETURN & \
"* DΘfinir le message de l'info-bulle (permet l'utilisation du caractΦre de retour α la ligne)" & RETURN & \
"* Obtenir la rΘfΘrence du comportement" & RETURN & RETURN & \
"Comportements associΘs :" & RETURN & \
"* Affichage de texte - Essentiel : doit Ωtre liΘ α une image-objet champ ou texte couvrant le mΩme nombre d'images." & RETURN & RETURN & \
"Vous pouvez trouver le comportement 'Affichage de texte' dans Palette des bibliothΦques, sous Contr⌠les > Affichage de texte."
end getBehaviorDescription
on getBehaviorTooltip me
return \
"Utilisable avec n'importe quel type d'acteur." & RETURN & RETURN & \
"Produit une info-bulle lorsque la souris survole l'image-objet." & RETURN & RETURN & \
"Ce comportement exige la disponibilitΘ du comportement 'Affichage de texte' dans une image-objet champ ou texte pour afficher les messages qu'il produit. " & \
"Si aucune telle image-objet n'est disponible, une alerte apparaεt (α la programmation uniquement)." & RETURN & RETURN & \
"Le paramΦtre dΘfini pour le comportement 'Affichage de texte' associΘ dΘtermine si le message de l'info-bulle apparaεt dans une barre d'Θtat ou en tant qu'affichage temporaire de l'info-bulle sur l'image-objet ou α proximitΘ de cette image-objet."
end getBehaviorTooltip
-- NOTES FOR DEVELOPERS --
-- The tool tip member appears in a separate sprite: myDisplaySprite. This
-- behavior merely tells the 'Display Text' behavior on myDisplaySprite what
-- text to display. Before it can do this, it must first discover the memory
-- address where the 'Display Text' behavior is stored. It does this through
-- the EnrollDisplaySprite handler. This is not called on beginSprite
-- since, logically, myDisplaySprite will be in a higher channel. If both
-- sprites begin in the same frame, myDisplaySprite may not have been
-- initialised yet.
-- You may have more than one sprite with the 'Display Text' behavior. It may
-- therefore be important to ensure that the Tooltip is sent to the right
-- sprite. However, while authoring, sprites tend to get moved around. The
-- EnrollDisplaySprite does its best to find a new instance of the
-- 'Display Text' behavior, but it warns the author that a conflict may be
-- occurring.
--
-- DECIDING WHEN TO DISPLAY THE TOOL TIP
-- The tooltip should only appear when the mouse is over the current sprite.
-- You may want the it only to be visible when the mouse is up. The
-- CheckStatus handler, called on each prepareFrame analyses the position and
-- state of the mouse, and either calls ShowTip, HideTip, or leaves things as
-- they are.
--
-- HideTip doesn't in fact hide anything. It merely displays an empty string.
-- If the 'Display Text' behavior is set to act as a Tooltip, it will move its
-- sprite off-stage. If it is set to act as a Status Bar, it will simply empty.
--
-- Since many behaviors may be sending messages to myDisplaySprite, I make sure
-- that these messages don't conflict. To do this, I use a boolean property:
-- myDisplayFlag. This toggles between TRUE and FALSE. While it is TRUE, no
-- further ShowTip messages are generated. It is set to FALSE when the tool
-- tip is hidden: HideTip is thus also only called once.
--
-- I could have chosen to use mouseEnter and mouseLeave to show and hide the
-- tip. This technique would make the tool tip appear immediately. I chose to
-- allow up to 2 seconds delay (120 ticks) before showing the tip. Instead of
-- using mouseEnter to trigger the ShowTip call directly, I use it to
-- calculate the value of the ticks when the call should be make. I store the
-- result in a property: myStartTicks. By setting myStartTicks to
-- the maxInteger on mouseLeave, I can be sure that ShowTip will not be
-- triggered.
--
-- POSITION OF TOOL TIP
-- ShowTip calculates where the tool tip should (ideally) be shown. The
-- 'Display Text' behavior on myDisplaySprite may overrule this for one of two
-- reasons:
-- * You have set the 'Display Text' behavior to act as a Status bar
-- * The ideal position of the tool tip would place it (partially) off-stage.
--
-- See the 'Notes for Developers' in the 'Display Text' behavior for more
-- details.
-- HISTORY --
-- 1 October 1998: Written for the D7 Behaviors Palette by James Newton
-- 29 October 1998: Descriptions improved, myPosition property extended.
-- 7 January 2000: Added isOKToAttach and substituteStrings event handlers.
-- Removed redundant error checking. - Karl Miller
-- PROPERTIES --
property mySprite
-- error checking
property getPDLError
-- author-defined parameters
property myString
property myDelay
property myPosition
property myDisplaySprite
property myHideFlag
-- internal properties
property myDisplayList
property myStartTicks
property myDisplayFlag
-- EVENT HANDLERS --
on beginSprite me
Initialize me
end beginSprite
on prepareFrame me
CheckStatus me
end prepareFrame
on mouseEnter me
myStartTicks = the ticks + myDelay
end mouseEnter
on mouseLeave me
myStartTicks = the maxinteger
end mouseLeave
-- CUSTOM HANDLERS --
on Initialize me -- sent by beginSprite
mySprite = sprite(me.spriteNum)
myMember = mySprite.member
myDisplayList = []
myStartTicks = the maxinteger
end Initialize
on CheckStatus me
if myStartTicks < the ticks then
if myHideFlag then
if the mouseDown then
if myDisplayFlag then
HideTip me
end if
exit
end if
end if
if myDisplayFlag then exit
ShowTip me
else if myDisplayFlag then
HideTip me
end if
end CheckStatus
on ShowTip me -- sent by prepareFrame
myDisplayFlag = TRUE
case myPosition of
"au centre au-dessus":
theAlignment = #bottomCenter
displayLoc = point ((mySprite.left + mySprite.right) / 2, mySprite.top)
"au centre en dessous":
displayLoc = point ((mySprite.left + mySprite.right) / 2, mySprite.bottom)
theAlignment = #topCenter
"en haut α gauche":
displayLoc = point (mySprite.left, mySprite.top)
theAlignment = #topLeft
"en haut α droite":
displayLoc = point (mySprite.right, mySprite.top)
theAlignment = #topRight
"au centre":
centerH = (mySprite.left + mySprite.right) / 2
centerV = (mySprite.top + mySprite.bottom) / 2
displayLoc = point (centerH, centerV)
theAlignment = #center
"en bas α gauche":
displayLoc = point (mySprite.left, mySprite.bottom)
theAlignment = #bottomLeft
"en bas α droite":
displayLoc = point (mySprite.right, mySprite.bottom)